home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Periodicals / develop / develop 7 code / Futures / TESample.r < prev    next >
Encoding:
Text File  |  1991-10-10  |  8.3 KB  |  353 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware TextEdit Sample Application
  6. #
  7. #    TESample
  8. #
  9. #    TESample.r    -    Rez Source
  10. #
  11. #    Copyright © Apple Computer, Inc. 1989-1990
  12. #    All rights reserved.
  13. #
  14. #    Versions:    
  15. #                1.00                08/88
  16. #                1.01                11/88
  17. #                1.02                04/89    MPW 3.1
  18. #                1.03                02/90    MPW 3.2
  19. #
  20. #    Components:
  21. #                TESample.p            Feb.  1, 1990
  22. #                TESample.c            Feb.  1, 1990
  23. #                TESampleGlue.a        Feb.  1, 1990
  24. #                TESample.r            Feb.  1, 1990
  25. #                TESample.h            Feb.  1, 1990
  26. #                [P]TESample.make    Feb.  1, 1990
  27. #                [C]TESample.make    Feb.  1, 1990
  28. #
  29. #    TESample is an example application that demonstrates how 
  30. #    to initialize the commonly used toolbox managers, operate 
  31. #    successfully under MultiFinder, handle desk accessories and 
  32. #    create, grow, and zoom windows. The fundamental TextEdit 
  33. #    toolbox calls and TextEdit autoscroll are demonstrated. It 
  34. #    also shows how to create and maintain scrollbar controls.
  35. #
  36. #    It does not by any means demonstrate all the techniques you 
  37. #    need for a large application. In particular, Sample does not 
  38. #    cover exception handling, multiple windows/documents, 
  39. #    sophisticated memory management, printing, or undo. All of 
  40. #    these are vital parts of a normal full-sized application.
  41. #
  42. #    This application is an example of the form of a Macintosh 
  43. #    application; it is NOT a template. It is NOT intended to be 
  44. #    used as a foundation for the next world-class, best-selling, 
  45. #    600K application. A stick figure drawing of the human body may 
  46. #    be a good example of the form for a painting, but that does not 
  47. #    mean it should be used as the basis for the next Mona Lisa.
  48. #
  49. #    We recommend that you review this program or Sample before 
  50. #    beginning a new application. Sample is a simple app. which doesn’t 
  51. #    use TextEdit or the Control Manager.
  52. #
  53. ------------------------------------------------------------------------------*/
  54.  
  55. #include "systypes.r"
  56. #include "types.r"
  57.  
  58. #include "TESample.h"
  59.  
  60. resource 'vers' (1) {
  61.     0x02, 0x00, release, 0x00,
  62.     verUS,
  63.     "1.03",
  64.     "1.03, Copyright \251 Apple Computer, Inc. 1989-1990"
  65. };
  66.  
  67. /* we use an MBAR resource to conveniently load all the menus */
  68.  
  69. resource 'MBAR' (rMenuBar, preload) {
  70.     { mApple, mFile, mEdit, mTest };        /* ••• Modified by MLG to demonstrate futures. ••• */
  71. };
  72.  
  73.  
  74. resource 'MENU' (mApple, preload) {
  75.     mApple, textMenuProc,
  76.     0b1111111111111111111111111111101,    /* disable dashed line, enable About and DAs */
  77.     enabled, apple,
  78.     {
  79.         "About TESample\311",
  80.             noicon, nokey, nomark, plain;
  81.         "-",
  82.             noicon, nokey, nomark, plain
  83.     }
  84. };
  85.  
  86. resource 'MENU' (mFile, preload) {
  87.     mFile, textMenuProc,
  88.     0b0000000000000000000100000000000,    /* enable Quit only, program enables others */
  89.     enabled, "File",
  90.     {
  91.         "New",
  92.             noicon, "N", nomark, plain;
  93.         "Open",
  94.             noicon, "O", nomark, plain;
  95.         "-",
  96.             noicon, nokey, nomark, plain;
  97.         "Close",
  98.             noicon, "W", nomark, plain;
  99.         "Save",
  100.             noicon, "S", nomark, plain;
  101.         "Save As\311",
  102.             noicon, nokey, nomark, plain;
  103.         "Revert",
  104.             noicon, nokey, nomark, plain;
  105.         "-",
  106.             noicon, nokey, nomark, plain;
  107.         "Page Setup\311",
  108.             noicon, nokey, nomark, plain;
  109.         "Print\311",
  110.             noicon, nokey, nomark, plain;
  111.         "-",
  112.             noicon, nokey, nomark, plain;
  113.         "Quit",
  114.             noicon, "Q", nomark, plain
  115.     }
  116. };
  117.  
  118. resource 'MENU' (mEdit, preload) {
  119.     mEdit, textMenuProc,
  120.     0b0000000000000000000000000000000,    /* disable everything, program does the enabling */
  121.     enabled, "Edit",
  122.      {
  123.         "Undo",
  124.             noicon, "Z", nomark, plain;
  125.         "-",
  126.             noicon, nokey, nomark, plain;
  127.         "Cut",
  128.             noicon, "X", nomark, plain;
  129.         "Copy",
  130.             noicon, "C", nomark, plain;
  131.         "Paste",
  132.             noicon, "V", nomark, plain;
  133.         "Clear",
  134.             noicon, nokey, nomark, plain
  135.     }
  136. };
  137.  
  138. /* ••• Added by MLG to demonstrate futures. ••••••••••••••••••••••••••••• */
  139. resource 'MENU' (mTest, preload) {
  140.     mTest, textMenuProc,
  141.     0b0000000000000000000000000000000,    /* disable everything, program does the enabling */
  142.     enabled, "Test",
  143.      {
  144.         "Ping",
  145.             noicon, "S", nomark, plain;
  146.         "Ping2",
  147.             noicon, nokey, nomark, plain;
  148.     }
  149. };
  150. /* •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• */
  151.  
  152. /* this ALRT and DITL are used as an About screen */
  153.  
  154. resource 'ALRT' (rAboutAlert, purgeable) {
  155.     {40, 20, 160, 296}, rAboutAlert, {
  156.         OK, visible, silent;
  157.         OK, visible, silent;
  158.         OK, visible, silent;
  159.         OK, visible, silent
  160.     };
  161. };
  162.  
  163. resource 'DITL' (rAboutAlert, purgeable) {
  164.     { /* array DITLarray: 5 elements */
  165.         /* [1] */
  166.         {88, 184, 108, 264},
  167.         Button {
  168.             enabled,
  169.             "OK"
  170.         },
  171.         /* [2] */
  172.         {8, 8, 24, 274},
  173.         StaticText {
  174.             disabled,
  175.             "MultiFinder-Aware TextEdit Application"
  176.         },
  177.         /* [3] */
  178.         {32, 8, 48, 295},
  179.         StaticText {
  180.             disabled,
  181.             "Copyright \251 Apple Computer 1989-1990"
  182.         },
  183.         /* [4] */
  184.         {56, 8, 72, 136},
  185.         StaticText {
  186.             disabled,
  187.             "Brought to you by:"
  188.         },
  189.         /* [5] */
  190.         {80, 24, 112, 167},
  191.         StaticText {
  192.             disabled,
  193.             "Macintosh Developer  Technical Support"
  194.         }
  195.     }
  196. };
  197.  
  198.  
  199. /* this ALRT and DITL are used as an error screen */
  200.  
  201. resource 'ALRT' (rUserAlert, purgeable) {
  202.     {40, 20, 150, 260},
  203.     rUserAlert,
  204.     { /* array: 4 elements */
  205.         /* [1] */
  206.         OK, visible, silent,
  207.         /* [2] */
  208.         OK, visible, silent,
  209.         /* [3] */
  210.         OK, visible, silent,
  211.         /* [4] */
  212.         OK, visible, silent
  213.     }
  214. };
  215.  
  216.  
  217. resource 'DITL' (rUserAlert, purgeable) {
  218.     { /* array DITLarray: 3 elements */
  219.         /* [1] */
  220.         {80, 150, 100, 230},
  221.         Button {
  222.             enabled,
  223.             "OK"
  224.         },
  225.         /* [2] */
  226.         {10, 60, 60, 230},
  227.         StaticText {
  228.             disabled,
  229.             "Error. ^0."
  230.         },
  231.         /* [3] */
  232.         {8, 8, 40, 40},
  233.         Icon {
  234.             disabled,
  235.             2
  236.         }
  237.     }
  238. };
  239.  
  240.  
  241. resource 'WIND' (rDocWindow, preload, purgeable) {
  242.     {64, 60, 314, 460},
  243.     zoomDocProc, invisible, goAway, 0x0, "untitled"
  244. };
  245.  
  246.  
  247. resource 'CNTL' (rVScroll, preload, purgeable) {
  248.     {-1, 385, 236, 401},
  249.     0, visible, 0, 0, scrollBarProc, 0, ""
  250. };
  251.  
  252.  
  253. resource 'CNTL' (rHScroll, preload, purgeable) {
  254.     {235, -1, 251, 386},
  255.     0, visible, 0, 0, scrollBarProc, 0, ""
  256. };
  257.  
  258. resource 'STR#' (kErrStrings, purgeable) {
  259.     {
  260.     "You must run on 512Ke or later";
  261.     "Application Memory Size is too small";
  262.     "Not enough memory to run TESample";
  263.     "Not enough memory to do Cut";
  264.     "Cannot do Cut";
  265.     "Cannot do Copy";
  266.     "Cannot exceed 32,000 characters with Paste";
  267.     "Not enough memory to do Paste";
  268.     "Cannot create window";
  269.     "Cannot exceed 32,000 characters";
  270.     "Cannot do Paste"
  271.     }
  272. };
  273.  
  274. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  275.  
  276. resource 'SIZE' (-1) {
  277.     dontSaveScreen,
  278.     acceptSuspendResumeEvents,
  279.     enableOptionSwitch,
  280.     canBackground,                /* we can background; we don't currently, but our sleep value */
  281.                                 /* guarantees we don't hog the Mac while we are in the background */
  282.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  283.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  284.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  285.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  286.     not32BitCompatible,            /* this app should not be run in 32-bit address space */
  287.     isHighLevelEventAware,        /* ••• Changed by MLG to demonstrate futures. ••• */
  288.     localAndRemoteHLEvents,        /* ••• Changed by MLG to demonstrate futures. ••• */
  289.     reserved,
  290.     reserved,
  291.     reserved,
  292.     reserved,
  293.     reserved,
  294.     kPrefSize * 1024,
  295.     kMinSize * 1024    
  296. };
  297.  
  298.  
  299. type 'MOOT' as 'STR ';
  300.  
  301.  
  302. resource 'MOOT' (0) {
  303.     "MultiFinder-Aware TextEdit Sample Application"
  304. };
  305.  
  306.  
  307. resource 'BNDL' (128) {
  308.     'MOOT',
  309.     0,
  310.     {
  311.         'ICN#',
  312.         {
  313.             0, 128
  314.         },
  315.         'FREF',
  316.         {
  317.             0, 128
  318.         }
  319.     }
  320. };
  321.  
  322.  
  323. resource 'FREF' (128) {
  324.     'APPL',
  325.     0,
  326.     ""
  327. };
  328.  
  329.  
  330. resource 'ICN#' (128) {
  331.     { /* array: 2 elements */
  332.         /* [1] */
  333.         $"04 30 40 00 0A 50 A0 00 0B 91 10 02 08 22 08 03"
  334.         $"12 24 04 05 20 28 02 09 40 10 01 11 80 0C 00 A1"
  335.         $"80 03 FF C2 7E 00 FF 04 01 00 7F 04 03 00 1E 08"
  336.         $"04 E0 00 0C 08 E0 00 0A 10 E0 00 09 08 C0 00 06"
  337.         $"04 87 FE 04 02 88 01 04 01 88 00 84 00 88 00 44"
  338.         $"00 88 00 44 00 88 00 C4 01 10 01 88 02 28 03 10"
  339.         $"01 C4 04 E0 00 02 08 00 73 BF FB EE 4C A2 8A 2A"
  340.         $"40 AA AA EA 52 AA AA 24 5E A2 8A EA 73 BE FB 8E",
  341.         /* [2] */
  342.         $"04 30 40 00 0E 70 E0 00 0F F1 F0 02 0F E3 F8 03"
  343.         $"1F E7 FC 07 3F EF FE 0F 7F FF FF 1F FF FF FF BF"
  344.         $"FF FF FF FE 7F FF FF FC 01 FF FF FC 03 FF FF F8"
  345.         $"07 FF FF FC 0F FF FF FE 1F FF FF FF 0F FF FF FE"
  346.         $"07 FF FF FC 03 FF FF FC 01 FF FF FC 00 FF FF FC"
  347.         $"00 FF FF FC 00 FF FF FC 01 FF FF F8 03 EF FF F0"
  348.         $"01 C7 FC E0 00 03 F8 00 73 BF FB EE 7F BE FB EE"
  349.         $"7F BE FB EE 7F BE FB E4 7F BE FB EE 73 BE FB 8E"
  350.     }
  351. };
  352.  
  353.